﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Practices.EnterpriseLibrary.Data;
using Enterprise.DataFactory;
using Enterprise.Model.CaiWu;
using Enterprise.Infrastructure;
namespace Enterprise.Data.CaiWu
{
    public class CwZbData
    {

        /// <summary>
        ///  数据列表
        /// </summary>
        /// <returns></returns>
        public List<CwZbEntity> CwZbList()
        {
            List<CwZbEntity> list = new List<CwZbEntity>();
            string cmd = "Select * from CWB_ZB";
            IDataReader dr = DbExecute.DataReader(cmd);
            while (dr.Read())
            {
                CwZbEntity entity = new CwZbEntity();
                if (!Convert.IsDBNull(dr["ZBID"])) entity.ZBID = Convert.ToInt32(dr["ZBID"]);
                if (!Convert.IsDBNull(dr["ZBTYPEID"])) entity.ZBTYPEID = Convert.ToInt32(dr["ZBTYPEID"]);
                if (!Convert.IsDBNull(dr["ZBCODE"])) entity.ZBCODE = Convert.ToString(dr["ZBCODE"]);
                if (!Convert.IsDBNull(dr["ZBNAME"])) entity.ZBNAME = Convert.ToString(dr["ZBNAME"]);
                if (!Convert.IsDBNull(dr["ZBNAMERU"])) entity.ZBNAMERU = Convert.ToString(dr["ZBNAMERU"]);
                if (!Convert.IsDBNull(dr["ZBUNIT"])) entity.ZBUNIT = Convert.ToString(dr["ZBUNIT"]);
                if (!Convert.IsDBNull(dr["ZBQZ"])) entity.ZBQZ = Convert.ToDecimal(dr["ZBQZ"]);
                if (!Convert.IsDBNull(dr["ZBORDERBY"])) entity.ZBORDERBY = Convert.ToInt32(dr["ZBORDERBY"]);
                list.Add(entity);
            }
            dr.Close();
            return list;
        }

        /// <summary>
        /// 数据操作方法
        /// </summary>
        /// <param name="cmd"></param>
        public void CwZbExecute(string cmd)
        {
            DbExecute.Execute(cmd);
        }

    }
}
